#include <stdio.h>
#include <string.h>

char* my_strstr(const char* str1, const char* str2)
{
	assert(str1 && str2);
	const char* s1 = NULL;
	const char* s2 = NULL;
	const char* p = str1;
	while (*p)
	{
		s1 = p;
		s2 = str2;
		int n = (int)strlen(s2);
		int ret = strncmp(s2, s1, n);
		if (ret == 0)
			return (char*)p;
		p++;
	}
	return NULL;
}

int main() {
	char a[] = "aadfgfes";
	char b[] = "ffr";
	char* str = my_strstr(a, b);
	if (str == NULL)
		printf("没找到\n");
	else
		printf("找到了：%s\n", str);
		
	return 0;
}